<?php
$count = count($packages);
$s = 0;
$values = array();
foreach ($packages as $pa) {
    $values[$s++] = unserialize($pa->values);
}
?>
<h1><span class="ico_createstore"></span><?= lang('label_create_store'); ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="javascript:void(0)"><?= lang('label_create_store'); ?></a></li>
    <li><?= lang('label_membership') ?></li>
</ul>

<form action="<?= current_url() ?>" method="post">
    <div class="page">
        <ul class="register_step">
            <li class="tou"><a href="javascript:void(0)"><?= lang('label_term_of_use') ?></a></li>
            <li class="register_step_arrow"></li>
            <li class="meb active"><a href="javascript:void(0)"><?= lang('label_membership') ?></a></li>
            <li class="register_step_arrow"></li>
            <li class="pay"><a href="javascript:void(0)"><?= lang('label_payment') ?></a></li>
            <li class="register_step_arrow"></li>
            <li class="sif"><a href="javascript:void(0)"><?= lang('label_finish') ?></a></li>
        </ul>

        <br />

        <table id="table1">
            <thead>
                <tr>
                    <th><span><?= lang('label_features') ?></span></th>
                    <?php foreach ($packages as $package) { ?>
                        <td><span class="<?= $package->css ?>"><?= $package->title ?></span></td>
                    <?php } ?>
                </tr>
            </thead>

            <tbody>
                <?php foreach ($pdetails as $pde) { ?>
                    <tr>
                        <td><?= $pde->title ?></td>
                        <?php for ($i = 0; $i < $count; $i++) { ?>
                            <td><?php
                                $val = $values[$i][$pde->name];
                                if ($val == 'false')
                                    echo '<span class="ico_false"></span>';
                                elseif ($val == 'true')
                                    echo '<span class="ico_true"></span>';
                                else {
                                    if (is_numeric($val)) {
                                        if ($val == 0)
                                            echo '-';
                                        else
                                            echo $val;
                                    }else {
                                        $val = explode('+', $val);
                                        $f = true;
                                        foreach ($val as $va) {
                                            if (lang('label_values_' . trim($va))) {
                                                if (!$f)
                                                    echo '+';
                                                echo lang('label_values_' . trim($va));
                                            } else {
                                                if (!$f)
                                                    echo '+';
                                                echo $va;
                                            }
                                            $f = false;
                                        }
                                    }
                                }
                                ?></td>
                        <?php } ?>
                    </tr>
                <?php } ?>
                <tr>
                    <td><?= lang('label_item_price').'/'.  lang('label_rial') ?></td>
                    <?php foreach ($packages as $package) { ?>
                        <td><?= $package->price ?></td>
                    <?php } ?>
                </tr>
            </tbody>

            <tfoot>
                <tr>
                    <th><?= lang('label_choose_your_offer') ?> &raquo;</th>
                    <?php foreach ($packages as $package) { ?>
                    <td><div class="radio"><input value="<?= $package->id ?>" name="package" id="<?= $package->id ?>" type="radio" /><label for="<?= $package->id ?>"></label></div></td>
                    <?php } ?>
                </tr>
            </tfoot>
        </table>


        <div class="submit">
            <input name="submit" value="<?= lang('label_next') ?>" type="submit"  />
        </div>
        <br /><br /><br />

    </div>
</form>